package com.android.task5;

import android.util.Log;

public class PanoramioRequest {
	
	private static final String INFO_TAG = "Panoramio REST Url Info";
	
	private static final String baseUrl = "www.panoramio.com";
	private static final int limit = 10;
	private BoundingBox bbox;
	
	private int northBorder;
	private int southBorder;
	private int westBorder;
	private int eastBorder;
	
	private String panoramioUrl;
	
	public PanoramioRequest(){
		panoramioUrl = "";
	}
//	
//	public PanoramioRequest (int minx, int maxx, int miny, int maxy){
//		this.northBorder = maxy;
//		this.southBorder = miny;
//		this.eastBorder = maxx;
//		this.westBorder = minx;
//		panoramioUrl = baseUrl;
//		panoramioUrl += "http://www.panoramio.com/map/get_panoramas.php?order=popularity";
//		panoramioUrl += "&set=public&from=0&to=100";
//		panoramioUrl += "&minx=";
//		panoramioUrl += westBorder;
//		panoramioUrl += "&miny=";
//		panoramioUrl += southBorder;
//		panoramioUrl += "&maxx=";
//		panoramioUrl += eastBorder;
//		panoramioUrl += "&maxy=";
//		panoramioUrl += northBorder;
//		panoramioUrl += "&size=medium";
//		
//	}
//	
//	public PanoramioRequest(BoundingBox bbox){
//		this.bbox = bbox;
//		panoramioUrl = baseUrl;
//		panoramioUrl += "http://www.panoramio.com/map/get_panoramas.php?order=popularity";
//		panoramioUrl += "&set=public&from=0&to=100";
//		panoramioUrl += "&minx=";
//		panoramioUrl += bbox.getBottomLeftCornerLatitude();
//		panoramioUrl += "&miny=";
//		panoramioUrl += bbox.getBottomLeftCornerLongitude();
//		panoramioUrl += "&maxx=";
//		panoramioUrl += bbox.getTopRightCornerLatitude();
//		panoramioUrl += "&maxy=";
//		panoramioUrl += bbox.getTopRightCornerLongitude();
//		panoramioUrl += "&size=medium";
//	}
	
	public void createStringURLforBoundingBox(BoundingBox bbox){
		this.bbox = bbox;

		panoramioUrl += "http://www.panoramio.com/map/get_panoramas.php?order=popularity";
		panoramioUrl += "&set=public&from=0&to=";
		panoramioUrl += limit;
		panoramioUrl += "&minx=";
		panoramioUrl += bbox.getBottomLeftCornerLongitude();
		panoramioUrl += "&miny=";
		panoramioUrl += bbox.getBottomLeftCornerLatitude();
		panoramioUrl += "&maxx=";
		panoramioUrl += bbox.getTopRightCornerLongitude();
		panoramioUrl += "&maxy=";
		panoramioUrl += bbox.getTopRightCornerLatitude();
		panoramioUrl += "&size=medium";
		
	}
	
	public String  getPanoramioRESTSearchURL(){
		return panoramioUrl;
	}
	
	public void getInfo(){
		Log.i(INFO_TAG, panoramioUrl);
	}
}
